package com.atguigu.msmservice.service.impl;

import com.atguigu.msmservice.service.MsmService;
import com.atguigu.msmservice.utils.MailUtils;
import com.mysql.cj.util.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @Author: shaki
 * @Date: 2021/6/22 10:49
 */
@Service
public class MsmServiceImpl implements MsmService {
    @Resource
    private MailUtils mailUtils;
    @Override
    public boolean send(String code, String email) {
        if(StringUtils.isNullOrEmpty(email)){
            return false;
        }
        boolean mail = mailUtils.sendMimeMail("注册验证码", "您的验证码为：" + code + "，5分钟内有效", email);
        if(mail){
            return true;
        }
        return false;
    }
}
